package com.angis.fx.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkConnectUtil {

	public static final String NETTYPE_WIFI = "WIFI";
	public static final String NETTYPE_3G = "3G";
	public static final String NETTYPE_NONE = "NONE";
	
	public static String validateNetworkStatus(Context pContext) {
		Context lContext = pContext.getApplicationContext();
		ConnectivityManager lConnManager = (ConnectivityManager) lContext.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo lNetworkInfo = lConnManager.getActiveNetworkInfo();
		int lNetType = lNetworkInfo.getType();
		if(lNetType == ConnectivityManager.TYPE_WIFI) {
			//WIFI
			return NETTYPE_WIFI;
		}else if(lNetType == ConnectivityManager.TYPE_MOBILE){
			//3G
			return NETTYPE_3G;
		}else {
			return NETTYPE_NONE;
		}
		
	}
	
}
